'use strict';

const vueConfig = {
    devServer: {
        // development server port 11520
        port: 11520,
        overlay: {
            warnings: false,
            errors: true
        },
        // proxy: {
        //   '/api': {
        //     target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro',
        //     ws: false,
        //     changeOrigin: true
        //   }
        // }
    },
    lintOnSave: 'warning',
    configureWebpack: {
        // provide the app's title in webpack's name field, so that
        // it can be accessed in index.html to inject the correct title.
        name: 'Vue Element Demo',
    },
    chainWebpack: config => {
        config
            .plugin('define')
            .tap(args => {
                args[0].APP_VERSION = `"${require('./package.json').version}"`;
                args[0].BUILD_DATE = JSON.stringify(new Date().toLocaleString());
                return args;
            });
    },
    // 禁用生产环境的 SourceMap
    productionSourceMap: false,
    css: {
        loaderOptions: {
            scss: {
                prependData: `@import "@/styles/variables.scss"; @import "@/styles/mixin.scss";`
            }
        }
    },
    pwa: {
        iconPaths: {
            favicon32: 'favicon.ico',
            favicon16: 'favicon.ico',
            appleTouchIcon: 'favicon.ico',
            maskIcon: 'favicon.ico',
            msTileImage: 'favicon.ico',
            faviconSVG: 'favicon.ico',
        }
    },
};

module.exports = vueConfig;